//
//  SubjectMessageView.m
//  xiaoyiNew
//
//  Created by TW on 2017/2/8.
//  Copyright © 2017年 讯一. All rights reserved.
//

#import "SubjectMessageView.h"

@interface SubjectMessageView ()
@property(nonatomic, strong) UITextField * textField;//输入框
@property(nonatomic, strong) UIButton * sendBut;//发送


@end
@implementation SubjectMessageView

- (instancetype)init
{
    self = [super init];
    if (self) {
        [self initializeDataSource];
        [self initializeUserInterface];
        [self initializeConstraints];
    }
    return self;
}

- (void)initializeDataSource {
    //更新数据
    
}
- (void)initializeUserInterface {
    //初始化界面
    self.backgroundColor = [UIColor whiteColor];
    [self addSubview:self.textField];
    [self addSubview:self.sendBut];
    
}
- (void)initializeConstraints {
    //设置约束
    [self.sendBut mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self);
        make.right.equalTo(self).offset(-10);
        make.height.mas_equalTo(30);
        make.width.mas_equalTo(50);
    }];
    [self.textField mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self);
        make.left.equalTo(self).offset(10);
        make.height.mas_equalTo(30);
        make.right.equalTo(self.sendBut).offset(-10);
    }];
}


#pragma mark - 点击 -
//发送
- (void)action_sendClick {

    NSLog(@"发送");
}
#pragma mark - lazy -
- (UITextField *)textField {

    
    if (!_textField) {
        _textField = [[UITextField alloc] init];
        _textField.placeholder = @"快来评论啦...";
    }
    return _textField;
    
}
- (UIButton *)sendBut {

    
    if (!_sendBut) {
        _sendBut = [UIButton buttonWithType:0];
        [_sendBut setTitle:@"发送" forState:0];
        [_sendBut setBackgroundColor:UIColorFromHex(0x01c7a6)];
        [_sendBut addTarget:self action:@selector(action_sendClick) forControlEvents:UIControlEventTouchUpInside];
    }
    return _sendBut;
    
}
@end
